function [md,mA,mB]=mindistsep(A,B)
% Computes the unique minimum distance of points from A to B. To each point
% A it finds the closest point B. 
% It is not ideal as in situation like this: o   xo x it does not performs
% optimally. But that is life. (It works under suggestion that the
% estimated points are close to the true ones. 
% [md,mA,mB]=mindistsep(A,B)
% md -
Aall=A; 
Ball=B;
n=min(size(Aall,1), size(Ball,1));
md=inf(n,1);
mA=zeros(n,1);
mB=zeros(n,1);
for ii=1:n
    d=sqrt(dist2(A,B));
    m=min(d,[],1);
    md(ii) = min(m);
    [mA(ii),mB(ii)]=find(d==md(ii),1);
    A(mA(ii),:)=inf(1,2); 
    B(mB(ii),:)=inf(1,2); 
end